#include <standard.hlsli>
#include <WR2Parameters.hlsli>

struct PixelToFrame
{
    float4 Color;
};

PixelToFrame ps_main2(VertexToPixel PSIn) : SV_TARGET
{
    PixelToFrame Output = (PixelToFrame) 0;

	// Set the color of the fog to grey.
    float4 fogColor = float4(0.2f, 0.2f, 0.2f, 0.50f);
		//	The fog color equation then does a linear interpolation between the texture color and the fog color based on the fog factor.;
		// Calculate the final color using the fog effect equation.;
		//finalColor = input.fogFactor * textureColor + (1.0 - input.fogFactor) * fogColor;
		//float4 TexColor = float4(smoothstep(0.4375, 0.5625, PSIn.kBlend.rgb), 1);
    float4 TexColor = float4(PSIn.kBlend.rgb * 8.0f - 3.5f, 1);
    Output.Color = PSIn.foger * TexColor + (1.0 - PSIn.foger) * fogColor;
    return Output;
}


PixelToFrame ps_main(VertexToPixel PSIn) : SV_TARGET
{
    PixelToFrame Output = (PixelToFrame) 0;
	
	//float sp = dot(PSIn.normal.xyz, -lightDir.xyz) * 1.0;
    float sp = clamp(abs(dot(PSIn.normal.xyz, normalize(CameraPosition.xyz - PSIn.pos2.xyz))) * 2, 0.5, 1) * 1.0 + 0.0;
    float sp2 = 0; // clamp(pow(dot(PSIn.normal.xyz, -lightDir.xyz), 5) * 5.5, 0, 1);
    float sp3 = (sp + sp2) / 2.0;

	//Output.Color = float4(PSIn.normal * 2.2 + 0.3 , 1);

	//Output.Color = float4(sp3, sp, sp, 1);
    Output.Color = float4(lerp(float3(1, 1, 1) * 1, PSIn.kBlend.xyz * 8 - 3.5, sp), 1);
    //Output.Color = float4(PSIn.kBlend.xyz * 8 - 3.5f, 1);

    return Output;
}